/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import { request } from '@umijs/max';

/** 此处后端没有提供注释 GET /api/v1/queryUserList */
export async function queryUserList(
  params: {
    // query
    /** keyword */
    keyword?: string;
    /** current */
    current?: number;
    /** pageSize */
    pageSize?: number;
  },
  options?: { [key: string]: any; },
) {
  return request<API.Result_PageInfo_UserInfo__>('/api/v1/queryUserList', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /api/v1/user */
// export async function addUser(
//   body?: API.UserInfoVO,
//   options?: { [key: string]: any },
// ) {
//   return request<API.Result_UserInfo_>('/api/v1/user', {
//     method: 'POST',
//     headers: {
//       'Content-Type': 'application/json',
//     },
//     data: body,
//     ...(options || {}),
//   });
// }

/** 此处后端没有提供注释 GET /api/v1/user/${param0} */
export async function getUserDetail(
  params: {
    // path
    /** userId */
    userId?: string;
  },
  options?: { [key: string]: any; },
) {
  const { userId: param0 } = params;
  return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 PUT /api/v1/user/${param0} */
export async function modifyUser(
  params: {
    // path
    /** userId */
    userId?: string;
  },
  body?: API.UserInfoVO,
  options?: { [key: string]: any; },
) {
  const { userId: param0 } = params;
  return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...params },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 DELETE /api/v1/user/${param0} */
// export async function deleteUser(
//   params: {
//     // path
//     /** userId */
//     userId?: string;
//   },
//   options?: { [key: string]: any },
// ) {
//   const { userId: param0 } = params;
//   return request<API.Result_string_>(`/api/v1/user/${param0}`, {
//     method: 'DELETE',
//     params: { ...params },
//     ...(options || {}),
//   });
// }


/** 新增账户 */
export async function addUser(data: API.AddUser) {
  return request('/all_api/bus/sysUser/addUserInfo', {
    method: 'POST',
    data,
  });
}
/** 编辑账户 */
export async function editUser(data: API.AddUser) {
  return request('/all_api/bus/sysUser/updUserInfo', {
    method: 'POST',
    data,
  });
}
/** 删除账户 */
export async function deleteUser(id: number) {
  return request('/all_api/bus/sysUser/delSysUser', {
    method: 'GET',
    params: { id },
  });
}
/** 批量删除账户 */
export async function deleteUserList(ids: React.Key[]) {
  return request('/all_api/bus/sysUser/delSysUserByList', {
    method: 'POST',
    data: ids,
  });
}
/** 获取树形部门 */
export async function getDepartTree() {
  return request('/all_api/bus/depart/getDepartTree', {
    method: 'GET'
  });
}
/** 获取树形岗位/角色类别，0岗位，1角色 */
export async function getPositionTree(plat: 0 | 1) {
  return request('/all_api/bus/Sys/getSysTypeTree', {
    method: 'GET',
    params: { plat }
  });
}
/** 新增树形岗位/角色分类类别，0岗位，1角色 */
export async function addPosRoleType(data: API.AddPosRoleType) {
  return request('/all_api/bus/Sys/addSysTypeInfo', {
    method: 'POST',
    data
  });
}
/** 修改树形岗位/角色分类类别，0岗位，1角色 */
export async function edutPosRoleType(data: API.AddPosRoleType) {
  return request('/all_api/bus/Sys/updSysTypeById', {
    method: 'POST',
    data
  });
}
/** 删除树形岗位/角色分类类别，0岗位，1角色 */
export async function delPosRoleType(id: string) {
  return request('/all_api/bus/Sys/delSysTypeById', {
    method: 'GET',
    params: { id }
  });
}
/** 获取所有岗位列表 */
export async function getAllPositionList() {
  return request('/all_api/bus/position/getPositionList', {
    method: 'GET'
  });
}
/** 获取岗位列表 */
export async function getPositionList(data: API.GetPositionList) {
  return request('/all_api/bus/position/getPositionPage', {
    method: 'POST',
    data
  });
}
/** 新增岗位 */
export async function addPosition(data: API.AddPosition) {
  return request('/all_api/bus/position/addPosition', {
    method: 'POST',
    data
  });
}
/** 修改岗位 */
export async function editPosition(data: API.AddPosition) {
  return request('/all_api/bus/position/updPositionById', {
    method: 'POST',
    data
  });
}
/** 删除岗位 */
export async function delPosition(id: string) {
  return request('/all_api/bus/position/delPositionById', {
    method: 'GET',
    params: { id }
  });
}
/** 批量删除岗位 */
export async function delAllPosition(ids: React.Key[]) {
  return request('/all_api/bus/position/delPositionByIds', {
    method: 'POST',
    data: ids
  });
}
/** 获取账户列表 */
export async function getAcountList(data: API.GetAcountList) {
  return request('/all_api/bus/sysUser/getSysUserPage', {
    method: 'POST',
    data
  });
}
/** 添加部门 */
export async function addDepartment(data: API.AddDepartment) {
  return request('/all_api/bus/depart/addDepart', {
    method: 'POST',
    data
  });
}
/** 删除部门 */
export async function delDepartment(id: string) {
  return request('/all_api/bus/depart/delDepart', {
    method: 'GET',
    params: { id }
  });
}
/** 修改部门 */
export async function editDepartment(data: API.AddDepartment) {
  return request('/all_api/bus/depart/updDepart', {
    method: 'POST',
    data
  });
}
/** 账号状态切换 */
export async function toggleAccount(id: string) {
  return request('/all_api/bus/sysUser/resetStatus', {
    method: 'GET',
    params: { id }
  });
}
/** 获取树形授权项 */
export async function getTreeItems(roleId?: string) {
  return request('/all_api/bus/role/getMenuAndElementTree', {
    method: 'GET',
    params: { roleId }
  });
}

/** 新增角色及授权项 */
export async function addRole(data: API.AddRole) {
  return request('/all_api/bus/role/addRoleAuthInfo', {
    method: 'POST',
    data
  });
}

/** 获取角色列表 */
export async function getRoleList(data: API.GetRoleList) {
  return request('/all_api/bus/role/getRolePage', {
    method: 'POST',
    data
  });
}
/** 编辑角色 */
export async function editRole(data: API.GetRoleList) {

  return request('/all_api/bus/role/updRoleById', {
    method: 'POST',
    data
  });
}
/** 删除角色 */
export async function delRole(id: string) {
  return request('/all_api/bus/role/delRoleById', {
    method: 'GET',
    params: { id }
  });
}
/** 批量删除角色 */
export async function delAllRole(ids: React.Key[]) {
  return request('/all_api/bus/role/delRoleByIds', {
    method: 'POST',
    data: ids
  });
}
/** 角色状态切换 */
export async function toggleRole(id: string) {
  return request('/all_api/bus/role/resetStatus', {
    method: 'GET',
    params: { id }
  });
}
/** 获取人员授权列表 */
export async function getAuthList(data: API.GetAuthList) {
  return request('/all_api/bus/userRole/page', {
    method: 'POST',
    data
  });
}
/** 新增授权人员列表 */
export async function addAuthList(data: API.AddAuthList) {
  return request('/all_api/bus/userRole/create', {
    method: 'POST',
    data
  });
}
/** 编辑人员权限 */
export async function editUserAuth(data: API.AddAuthList) {
  return request('/all_api/bus/userRole/update', {
    method: 'POST',
    data
  });
}
/** 获取人员授权项 */
export async function getUserAuthItem(id?: string) {
  return request('/all_api/bus/userRole/select', {
    method: 'GET',
    params: { id }
  });
}
/** 删除授权人员 */
export async function delUserAuth(id: string) {
  return request('/all_api/bus/userRole/remove', {
    method: 'GET',
    params: { id }
  });
}
/** 获取菜单列表 */
export async function getMenuList() {
  return request('/all_api/bus/menu/tree', {
    method: 'POST',
    data: {}
  });
}
/** 新增菜单 */
export async function addMenu(data: API.EditMenu) {
  return request('/all_api/bus/menu/create', {
    method: 'POST',
    data
  });
}
/** 删除菜单 */
export async function delMenu(id: number) {
  return request('/all_api/bus/menu/remove', {
    method: 'GET',
    params: { id }
  });
}
/** 更新菜单 */
export async function editMenu(data: API.EditMenu) {
  return request('/all_api/bus/menu/update', {
    method: 'POST',
    data
  });
}
/** 获取菜单详情 */
export async function getMenuDetail(id: string) {
  return request('/all_api/bus/menu/select', {
    method: 'GET',
    params: { id }
  });
}
/** 获取菜单元素列表 */
export async function getMenuElement(data: API.GetMenuElement) {
  return request('/all_api/bus/element/page', {
    method: 'POST',
    data
  });
}
/** 删除菜单元素 */
export async function delMenuElement(id: number) {
  return request('/all_api/bus/element/remove', {
    method: 'GET',
    params: { id }
  });
}
/** 新增菜单授权元素 */
export async function addMenuElement(data: API.UpdateMenuElement) {
  return request('/all_api/bus/element/create', {
    method: 'POST',
    data
  });
}
/** 一键新增权限元素 */
export async function addAllElement(data: API.UpdateMenuElement[]) {
  return request('/all_api/bus/element/batchCreate', {
    method: 'POST',
    data
  });
}

/** 更新菜单元素列表 */
export async function updateMenuElement(data: API.UpdateMenuElement) {
  return request('/all_api/bus/element/update', {
    method: 'POST',
    data
  });
}
/** 更新菜单元素状态 */
export async function toggleElement(id: string) {
  return request('/all_api/bus/element/resetStatus', {
    method: 'GET',
    params: { id }
  });
}
/** 获取权限按钮 */
export async function getAuthElement(appId: string) {
  return request('/all_api/bus/auth/getElements', {
    method: 'GET',
    params: { appId }
  });
}
/** 获取应用类型列表 */
export async function getTypeList() {
  return request('/all_api/bus/menu/getAppTypeList');
}
/** 文件上传 */
export async function upload(file: FormData) {
  return request('/all_api/bus/uploadFile/ossUploadFile', {
    method: 'POST',
    data: file
  });
}

